package com.ztjava.upload;

import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.template.Engine;
import com.ztjava.core.base.BaseSub;
import com.ztjava.core.tool.ViewTool;
import com.ztjava.upload.cloud.QiniuSdk;

public class Upload extends BaseSub{

	@Override
	public void configConstant(Constants me) {
		
		
	}

	@Override
	public void configRoute(Routes me) {
		
		
	}

	@Override
	public void configEngine(Engine me) {
		
		
	}

	@Override
	public void configPlugin(Plugins me) {
		
		
	}

	@Override
	public void configInterceptor(Interceptors me) {
		
		
	}

	@Override
	public void configHandler(Handlers me) {
		
		
	}

	@Override
	public void afterJFinalStart() {
		
		
	}

	@Override
	public void startComplete() {
		if(ViewTool.param("UPLOAD_FILES_CLOUD_TYPE").equals("qiniu")){
			QiniuSdk.accessKey = ViewTool.param("UPLOAD_FILES_CLOUD_QINIU_ACCESSKEY");
			QiniuSdk.secretKey = ViewTool.param("UPLOAD_FILES_CLOUD_QINIU_SECRETKEY");
			QiniuSdk.bucket = ViewTool.param("UPLOAD_FILES_CLOUD_QINIU_BUCKET");
			QiniuSdk.cdn = ViewTool.param("UPLOAD_FILES_CLOUD_QINIU_CDN");
		    if(!QiniuSdk.cdn.endsWith("/")){
		    	QiniuSdk.cdn = QiniuSdk.cdn + "/";
		    }
		}
		
	}
}
